Page({
  data: {
    id:'',
    form:'',
  },
  onLoad: function (options) {
     if(options.from=='pj')
     {
       this.setData({
         id: options.order_id,
         form: options.from,
         payResult: options.flag,
       });
     }
     if (options.from == 'order')
     {
       this.setData({
         payResult: options.flag,
         id: options.id,
         from: true
       });
     }
    
  },
  viewOrder: function () {
    if (this.data.from =='order') {
      wx.redirectTo({
        url: '../order/orderDetails?from=order&id=' + this.data.id
      });
    } else {
      //pj过来几秒后返回首页
      timer = setTimeout(function () {
        wx.switchTab({
          url: "../../index/index"
        });
      }, 2000);
    }
  },
  //评价
  returnOrder: function () {
    var orderid =this.data.id;
    wx.navigateTo({
      url: '../review/review?id=' + orderid,
    });
  }
  /*returnOrder: function () {
      //返回上一级
      wx.navigateBack({
        delta: 1
      })
    }*/
})